<template>
  <view class="card">
    <view class="card_content">
      <view class="card_content_head">
        <el-avatar v-if="options.avatar" class="card_content_head-avatar">{{ options.avatar }}</el-avatar>
        <el-avatar v-else icon="el-icon-user-solid" class="card_content_head-avatar"></el-avatar>
        <view class="card_content_head_left">
          <text v-if="options.username" class="card_content_head-username">{{ options.username }}</text>
          <text v-if="options.time" class="card_content_head-time">{{ options.time }}</text>
        </view>
      </view>
      <view class="card_content_body">
        <rich-text :nodes="options.content"></rich-text>
      </view>
      <view class="card_content_foot">

      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: "InformationCard",
  props: {
    options: {
      type: Object
    }
  }
}
</script>

<style lang="scss" scoped>
.card {
  padding: 20px 10%;
  box-sizing: border-box;
  height: 100%;

  &_content {
    width: 100%;
    box-shadow: 2px 3px 4px rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
    height: 100%;

    &_head {
      display: flex;
      flex-direction: row;
      align-items: center;

      &_left {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        margin-left: 10px;
      }

      &-username {
        font-size: 1.2em;
      }

      &-time {
        font-size: 0.8em;
        color: #ccc;
      }

      &-avatar {
        width: 40px;
        height: 40px;
        text-align: center;
        line-height: 40px;
        border-radius: 50%;
      }
    }

    &_body {
      background-color: rgba(204, 204, 204, 0.1);
      padding: 5px;
      height: 100%;
      width: 100%;
    }
  }
}
</style>
